package com.jsh.erp.datasource.mappers;

import com.jsh.erp.datasource.entities.PromotionDepot;
import com.jsh.erp.datasource.entities.PromotionHead;
import com.jsh.erp.datasource.entities.PromotionItem;
import com.jsh.erp.datasource.entities.PromotionSupplier;
import com.jsh.erp.datasource.vo.*;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

public interface PromotionHeadMapperEx {

    List<PromotionHeadWithSupplier> selectByPromotionHead(
            @Param("name") String name,
            @Param("promotionType") String promotionType,
            @Param("startTime") String startTime,
            @Param("endTime") String endTime,
            @Param("promotionState") String promotionState,
            @Param("offset") Integer offset,
            @Param("rows") Integer rows);

    Long countsByPromotionHead(
            @Param("name") String name,
            @Param("promotionType") String promotionType,
            @Param("startTime") String startTime,
            @Param("endTime") String endTime,
            @Param("promotionState") String promotionState);

    PromotionHead getPromotionById(String id);


//    List<PromotionVoDetail> getPromotionHeadByCode( @Param("materialId") String materialId,
//                                              @Param("meId") String meId,
//                                              @Param("commodityUnit") String commodityUnit,
//                                              @Param("promotionType") Integer promotionType,
//                                              @Param("custom11") Integer custom11);
    List<PromotionVoDetail> getPromotionHeadByCode( @Param("materialId") String materialId,
                                              @Param("meId") String meId,
                                              @Param("commodityUnit") String commodityUnit,
                                              @Param("promotionType") Integer promotionType,
                                               @Param("holdSupplier") Integer holdSupplier,
                                              @Param("custom11") Integer custom11,
                                              @Param("supplierId") String supplierId);

    List<PromotionVoDetail> checkMaterialWithHeaderId( @Param("materialId") String materialId,
                                              @Param("meId") String meId,
                                              @Param("commodityUnit") String commodityUnit,
                                              @Param("promotionType") Integer promotionType,
                                              @Param("headerId") String headerId,
                                              @Param("custom11") Integer custom11);

    List<CheckPromotionMaterialWithSupplier> checkMaterialWithSupplierId(@Param("promotionType") Integer promotionType,
                                                                         @Param("custom11") Integer custom11,
                                                                         @Param("headerId") String headerId,
                                                                         @Param("holdSupplier") Integer holdSupplier,
                                                                         @Param("materialId") String materialId,
                                                                         @Param("supplierId") String supplierId);

    List<PromotionVoDetail> getPromotionHeadById( @Param("materialId") String materialId,@Param("custom11") Integer custom11,
                                                  @Param("holdSupplier") Integer holdSupplier,
                                                  @Param("supplierId") String supplierId);

    List<PromotionVoDetail> getPromotionGiveById( @Param("materialId") String materialId,@Param("commodityUnit") String commodityUnit,@Param("custom11")Integer custom11,
                                                  @Param("holdSupplier") Integer holdSupplier,
                                                  @Param("supplierId") String supplierId);
    List<PromotionVoDetail> lsGetPromotionGiveById( @Param("materialId") String materialId);
    List<PromotionVoDetail> lsGetPromotionSpecialById( @Param("materialExtendId") String materialExtendId,
                                                       @Param("materialId") String materialId,
                                                       @Param("promotionType") Integer promotionType);

    List<PromotionItemWithMaterial> getMaterialById(@Param("headerId") String headerId);

    List<PromotionGiftWithMaterial> getMaterialByGiftId(@Param("itemId") String itemId);

    List<PromotionSupplier> getSupplierId(@Param("headerId") String headerId);

    List<PromotionDepot> getDepotId(@Param("headerId") String headerId);

    int batchDeletePromotionItemByHeaderId(@Param("headerId") String headerId);

    int batchDeletePromotionItemById(@Param("id") String id);

    int batchDeletePromotionSupplierByHeaderId(@Param("headerId") String headerId);

    int batchDeletePromotionSupplierById(@Param("id") String id);

    int batchDeletePromotionDepotByHeaderId(@Param("headerId") String headerId);

    int batchDeletePromotionGiftByItemId(@Param("itemId") String itemId);

    List<PromotionVoDetail> getSpecial( @Param("materialId") String materialId,@Param("custom11") Integer custom11,@Param("operNumber") BigDecimal operNumber,
                                        @Param("holdSupplier") Integer holdSupplier,
                                        @Param("supplierId") String supplierId);
}
